import pandas as pd
import tkinter
import requests
from bs4 import BeautifulSoup
from lxml import etree
df=pd.read_html(r'https://money.finance.sina.com.cn/corp/view/vFD_FinancialGuideLineHistory.php?stockid=600031&typecode=financialratios61')[3]
df.columns=['时间','加权每股收益率','变动比例']
df1=df.sort_index(ascending=False)
print(df1)
df1.to_excel(r'C:\Users\Administrator\Desktop\财务指标.xlsx')
plt.plot(df1['时间'],df['摊薄每股收益率'])
plt.show()
'''
for i in range(len(df)):
    print(df[i])
    print(i,'**********'*10)
'''

